{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# pyecharts的作图方法与修饰逻辑"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import json\n",
    "from pandas.io.json import json_normalize\n",
    "from collections import Counter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## python的两种数据作图方案\n",
    "\n",
    "* matplotlib 简单方便，适合数值作图与科学作图（论文发表）\n",
    "* pyecharts 流程略微复杂但功能强大，图形为交互式，适合项目开发和商业分析报告(国人开发)；但是这个库的问题也在于是一个非常新的库，开发很不稳定~当前课件版本是pyecharts1.5，未来变化可能导致课件代码无法使用。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 作图的通用流程\n",
    "\n",
    "1，选择图的类型\n",
    "\n",
    "2，导入图需要展示的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "x=range(1,8)\n",
    "y=[114, 55, 27, 101, 125, 27, 105]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 7 artists>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAADm9JREFUeJzt3W+MZXV9x/H3R1ZUsGbRHcl2l3Qw2dBS0xYyoVoSY1xboRDggSQQazeWZtuEWqxNZLEPSB+YYNqobdKabFh0TSmIoIGotRKEWB+AnUUqfxbLFhFGkB2j+DepRb99MIdkJLNzZ+65lzPz4/1KNveec8+995vN5r1nfvfPpKqQJLXrJUMPIEmaLkMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUuC1DDwCwbdu2mp2dHXoMSdpUDh069N2qmhl13IYI/ezsLPPz80OPIUmbSpJvreU4l24kqXGGXpIaZ+glqXGGXpIaZ+glqXGGXpIaZ+glqXGGXpIaZ+glqXEb4pOxkmB23+eGHuGXPHbNeUOPoAnxjF6SGmfoJalxhl6SGjcy9EmuS3I0yQPL9v1dkoeTfD3JZ5JsXXbbVUmOJPlGkrdNa3BJ0tqs5Yz+48A5z9t3O/D6qvot4L+BqwCSnA5cAvxmd59/TnLcxKaVJK3byNBX1ZeB7z1v3xer6tlu825gZ3f9QuDGqvrfqvomcAQ4a4LzSpLWaRJr9H8C/Ft3fQfwxLLbFrp9kqSB9Ap9kr8BngWuf27XCofVMe67N8l8kvnFxcU+Y0iSVjF26JPsAc4H3lFVz8V8AThl2WE7gSdXun9V7a+quaqam5kZ+SsPJUljGiv0Sc4BrgQuqKqfLrvpNuCSJC9LciqwC/hq/zElSeMa+RUISW4A3gxsS7IAXM3Su2xeBtyeBODuqvrzqnowyU3AQywt6VxeVT+f1vCSpNFGhr6qLl1h94FVjv8A8IE+Q0mSJsdPxkpS4wy9JDXO0EtS4wy9JDXO0EtS4zb9b5jyt/JI0uo8o5ekxhl6SWqcoZekxhl6SWqcoZekxhl6SWqcoZekxhl6SWqcoZekxhl6SWqcoZekxhl6SWqcoZekxhl6SWrcpv+aYklajxfjV5t7Ri9JjTP0ktQ4Qy9JjRsZ+iTXJTma5IFl+16d5PYkj3SXJ3X7k+QfkxxJ8vUkZ05zeEnSaGs5o/84cM7z9u0D7qiqXcAd3TbAucCu7s9e4KOTGVOSNK6R77qpqi8nmX3e7guBN3fXDwJ3AVd2+z9RVQXcnWRrku1V9dSkBpbW6sX47gppJeOu0Z/8XLy7y9d2+3cATyw7bqHbJ0kayKRfjM0K+2rFA5O9SeaTzC8uLk54DEnSc8YN/dNJtgN0l0e7/QvAKcuO2wk8udIDVNX+qpqrqrmZmZkxx5AkjTJu6G8D9nTX9wC3Ltv/x927b94A/MD1eUka1sgXY5PcwNILr9uSLABXA9cANyW5DHgcuLg7/PPAHwJHgJ8C75rCzJKkdVjLu24uPcZNu1c4toDL+w4lSZocPxkrSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY0z9JLUOEMvSY3rFfokf5XkwSQPJLkhycuTnJrkniSPJPlkkuMnNawkaf3GDn2SHcBfAnNV9XrgOOAS4IPAh6tqF/B94LJJDCpJGk/fpZstwCuSbAFOAJ4C3gLc3N1+ELio53NIknoYO/RV9W3g74HHWQr8D4BDwDNV9Wx32AKwY6X7J9mbZD7J/OLi4rhjSJJG6LN0cxJwIXAq8KvAicC5KxxaK92/qvZX1VxVzc3MzIw7hiRphD5LN28FvllVi1X1f8Cngd8DtnZLOQA7gSd7zihJ6qFP6B8H3pDkhCQBdgMPAXcCb++O2QPc2m9ESVIffdbo72HpRdd7gfu7x9oPXAm8N8kR4DXAgQnMKUka05bRhxxbVV0NXP283Y8CZ/V5XEnS5PjJWElqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMYZeklqnKGXpMb1Cn2SrUluTvJwksNJ3pjk1UluT/JId3nSpIaVJK1f3zP6fwC+UFW/Dvw2cBjYB9xRVbuAO7ptSdJAxg59klcBbwIOAFTVz6rqGeBC4GB32EHgor5DSpLG1+eM/nXAIvCxJF9Lcm2SE4GTq+opgO7ytSvdOcneJPNJ5hcXF3uMIUlaTZ/QbwHOBD5aVWcAP2EdyzRVtb+q5qpqbmZmpscYkqTV9An9ArBQVfd02zezFP6nk2wH6C6P9htRktTH2KGvqu8ATyQ5rdu1G3gIuA3Y0+3bA9zaa0JJUi9bet7/3cD1SY4HHgXexdJ/HjcluQx4HLi453NIknroFfqqug+YW+Gm3X0eV5I0OX4yVpIaZ+glqXGGXpIa1/fFWI1hdt/nhh7hlzx2zXlDjyBpijyjl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJalzv0Cc5LsnXkny22z41yT1JHknyySTH9x9TkjSuSZzRXwEcXrb9QeDDVbUL+D5w2QSeQ5I0pl6hT7ITOA+4ttsO8Bbg5u6Qg8BFfZ5DktRP3zP6jwDvA37Rbb8GeKaqnu22F4AdPZ9DktTD2KFPcj5wtKoOLd+9wqF1jPvvTTKfZH5xcXHcMSRJI/Q5oz8buCDJY8CNLC3ZfATYmmRLd8xO4MmV7lxV+6tqrqrmZmZmeowhSVrN2KGvqquqamdVzQKXAF+qqncAdwJv7w7bA9zae0pJ0tim8T76K4H3JjnC0pr9gSk8hyRpjbaMPmS0qroLuKu7/ihw1iQeV5LUn5+MlaTGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJatxEfvGI2je773NDj/BLHrvmvKFHEP672Cw8o5ekxhl6SWqcoZekxhl6SWqcoZekxhl6SWqcoZekxo0d+iSnJLkzyeEkDya5otv/6iS3J3mkuzxpcuNKktarzxn9s8BfV9VvAG8ALk9yOrAPuKOqdgF3dNuSpIGMHfqqeqqq7u2u/wg4DOwALgQOdocdBC7qO6QkaXwTWaNPMgucAdwDnFxVT8HSfwbAayfxHJKk8fQOfZJXArcA76mqH67jfnuTzCeZX1xc7DuGJOkYeoU+yUtZivz1VfXpbvfTSbZ3t28Hjq5036raX1VzVTU3MzPTZwxJ0ir6vOsmwAHgcFV9aNlNtwF7uut7gFvHH0+S1Fefryk+G3gncH+S+7p97weuAW5KchnwOHBxvxElSX2MHfqq+gqQY9y8e9zHlSRNlp+MlaTGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJapyhl6TGGXpJatzUQp/knCTfSHIkyb5pPY8kaXVTCX2S44B/As4FTgcuTXL6NJ5LkrS6aZ3RnwUcqapHq+pnwI3AhVN6LknSKqYV+h3AE8u2F7p9kqQXWKpq8g+aXAy8rar+tNt+J3BWVb172TF7gb3d5mnANyY+yPpsA7478Azr5cwvjM0282abF5x5XL9WVTOjDtoypSdfAE5Ztr0TeHL5AVW1H9g/pedftyTzVTU39Bzr4cwvjM0282abF5x52qa1dPOfwK4kpyY5HrgEuG1KzyVJWsVUzuir6tkkfwH8O3AccF1VPTiN55IkrW5aSzdU1eeBz0/r8adgwywjrYMzvzA228ybbV5w5qmayouxkqSNw69AkKTGvehDn+S6JEeTPDD0LGuV5JQkdyY5nOTBJFcMPdNqkrw8yVeT/Fc3798OPdNaJTkuydeSfHboWdYiyWNJ7k9yX5L5oedZiyRbk9yc5OHu3/Qbh55pNUlO6/5+n/vzwyTvGXqu1bzol26SvAn4MfCJqnr90POsRZLtwPaqujfJrwCHgIuq6qGBR1tRkgAnVtWPk7wU+ApwRVXdPfBoIyV5LzAHvKqqzh96nlGSPAbMVdXQ7+9esyQHgf+oqmu7d+mdUFXPDD3XWnRf9/Jt4Her6ltDz3MsL/oz+qr6MvC9oedYj6p6qqru7a7/CDjMBv7kcS35cbf50u7Phj/DSLITOA+4duhZWpXkVcCbgAMAVfWzzRL5zm7gfzZy5MHQb3pJZoEzgHuGnWR13RLIfcBR4Paq2tDzdj4CvA/4xdCDrEMBX0xyqPv0+Ub3OmAR+Fi3RHZtkhOHHmodLgFuGHqIUQz9JpbklcAtwHuq6odDz7Oaqvp5Vf0OS5+SPivJhl4mS3I+cLSqDg09yzqdXVVnsvTNsZd3S5Mb2RbgTOCjVXUG8BNgU3ytebfMdAHwqaFnGcXQb1LdWvctwPVV9emh51mr7sfyu4BzBh5llLOBC7o17xuBtyT5l2FHGq2qnuwujwKfYembZDeyBWBh2U94N7MU/s3gXODeqnp66EFGMfSbUPfi5gHgcFV9aOh5Rkkyk2Rrd/0VwFuBh4edanVVdVVV7ayqWZZ+PP9SVf3RwGOtKsmJ3YvzdMsffwBs6HeTVdV3gCeSnNbt2g1syDcVrOBSNsGyDUzxk7GbRZIbgDcD25IsAFdX1YFhpxrpbOCdwP3dujfA+7tPI29E24GD3TsUXgLcVFWb4u2Km8zJwGeWzgPYAvxrVX1h2JHW5N3A9d1SyKPAuwaeZ6QkJwC/D/zZ0LOsxYv+7ZWS1DqXbiSpcYZekhpn6CWpcYZekhpn6CWpcYZekhpn6CWpcYZekhr3/+GEd339Pd81AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.bar(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(1, 4)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(1,4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"4734100a6fb74165bda6d2a3a8bf2471\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_4734100a6fb74165bda6d2a3a8bf2471 = echarts.init(\n",
       "                    document.getElementById('4734100a6fb74165bda6d2a3a8bf2471'), 'white', {renderer: 'canvas'});\n",
       "                var option_4734100a6fb74165bda6d2a3a8bf2471 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"iii\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"iii\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"iii\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_4734100a6fb74165bda6d2a3a8bf2471.setOption(option_4734100a6fb74165bda6d2a3a8bf2471);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x201b7bbb0f0>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"iii\", y)\n",
    "bar.render_notebook()#用来在notebook中展示图形，使用render则会直接保存为html文件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## pyecharts的安装\n",
    "\n",
    "* 就winpython来说，双击WinPython Command Prompt，会打开一个终端，在此终端中键入拷贝如下命令，并按回车：\n",
    "\n",
    "pip  install  -i  https://pypi.doubanio.com/simple/  --trusted-host pypi.doubanio.com pyecharts\n",
    "\n",
    "上面命令是用豆瓣源来进行包的安装"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### pyecharts支持的代码格式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts.faker import Faker\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar\n",
    "\n",
    "\n",
    "def bar_base() -> Bar:\n",
    "    c = (\n",
    "        Bar()\n",
    "        .add_xaxis(Faker.choose())\n",
    "        .add_yaxis(\"商家A\", Faker.values())\n",
    "        .add_yaxis(\"商家B\", Faker.values())\n",
    "        .set_global_opts(title_opts=opts.TitleOpts(title=\"Bar-基本示例\", subtitle=\"我是副标题\"))\n",
    "    )\n",
    "    return c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"73a1b85100f94fabbd3797bdc9fcd0ea\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_73a1b85100f94fabbd3797bdc9fcd0ea = echarts.init(\n",
       "                    document.getElementById('73a1b85100f94fabbd3797bdc9fcd0ea'), 'white', {renderer: 'canvas'});\n",
       "                var option_73a1b85100f94fabbd3797bdc9fcd0ea = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"data\": [\n",
       "                81,\n",
       "                38,\n",
       "                98,\n",
       "                129,\n",
       "                76,\n",
       "                46,\n",
       "                116\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"data\": [\n",
       "                33,\n",
       "                67,\n",
       "                46,\n",
       "                51,\n",
       "                138,\n",
       "                23,\n",
       "                65\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5468\\u4e00\",\n",
       "                \"\\u5468\\u4e8c\",\n",
       "                \"\\u5468\\u4e09\",\n",
       "                \"\\u5468\\u56db\",\n",
       "                \"\\u5468\\u4e94\",\n",
       "                \"\\u5468\\u516d\",\n",
       "                \"\\u5468\\u65e5\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Bar-\\u57fa\\u672c\\u793a\\u4f8b\",\n",
       "            \"subtext\": \"\\u6211\\u662f\\u526f\\u6807\\u9898\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_73a1b85100f94fabbd3797bdc9fcd0ea.setOption(option_73a1b85100f94fabbd3797bdc9fcd0ea);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2b01804f4a8>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar_base().render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"9020ca4082f64270b8cec8dd903f5e4d\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_9020ca4082f64270b8cec8dd903f5e4d = echarts.init(\n",
       "                    document.getElementById('9020ca4082f64270b8cec8dd903f5e4d'), 'white', {renderer: 'canvas'});\n",
       "                var option_9020ca4082f64270b8cec8dd903f5e4d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"data\": [\n",
       "                106,\n",
       "                93,\n",
       "                79,\n",
       "                66,\n",
       "                66,\n",
       "                21,\n",
       "                115\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"data\": [\n",
       "                131,\n",
       "                86,\n",
       "                70,\n",
       "                150,\n",
       "                99,\n",
       "                45,\n",
       "                136\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u53ef\\u4e50\",\n",
       "                \"\\u96ea\\u78a7\",\n",
       "                \"\\u6a59\\u6c41\",\n",
       "                \"\\u7eff\\u8336\",\n",
       "                \"\\u5976\\u8336\",\n",
       "                \"\\u767e\\u5a01\",\n",
       "                \"\\u9752\\u5c9b\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Bar-\\u57fa\\u672c\\u793a\\u4f8b\",\n",
       "            \"subtext\": \"\\u6211\\u662f\\u526f\\u6807\\u9898\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_9020ca4082f64270b8cec8dd903f5e4d.setOption(option_9020ca4082f64270b8cec8dd903f5e4d);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2b01804fe80>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g1=Bar()\n",
    "g1.add_xaxis(Faker.choose())\n",
    "g1.add_yaxis(\"商家A\", Faker.values())\n",
    "g1.add_yaxis(\"商家B\", Faker.values())\n",
    "g1.set_global_opts(title_opts=opts.TitleOpts(title=\"Bar-基本示例\", subtitle=\"我是副标题\"))\n",
    "g1.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"4ca8b7dad3c14ecc8dd7e11984556d3b\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_4ca8b7dad3c14ecc8dd7e11984556d3b = echarts.init(\n",
       "                    document.getElementById('4ca8b7dad3c14ecc8dd7e11984556d3b'), 'white', {renderer: 'canvas'});\n",
       "                var option_4ca8b7dad3c14ecc8dd7e11984556d3b = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_4ca8b7dad3c14ecc8dd7e11984556d3b.setOption(option_4ca8b7dad3c14ecc8dd7e11984556d3b);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1f38050a278>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Bar().add_xaxis(list(x)).add_yaxis(\"name\", y).render_notebook()#用来在notebook中展示图形，使用render则会直接保存为html文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"d29251b162094f8e882cc59c7c2c7f15\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_d29251b162094f8e882cc59c7c2c7f15 = echarts.init(\n",
       "                    document.getElementById('d29251b162094f8e882cc59c7c2c7f15'), 'white', {renderer: 'canvas'});\n",
       "                var option_d29251b162094f8e882cc59c7c2c7f15 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_d29251b162094f8e882cc59c7c2c7f15.setOption(option_d29251b162094f8e882cc59c7c2c7f15);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1b399a82518>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# pyecharts的链式写法\n",
    "Bar().add_xaxis(list(x)).add_yaxis(\"name\", y).render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 在线教程中的函数形式主要是项目开发中面向对象程序的书写习惯"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['周一', '周二', '周三', '周四', '周五', '周六', '周日']"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Faker.choose()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opts\n",
    "# 内置主题类型可查看 pyecharts.globals.ThemeType\n",
    "from pyecharts.globals import ThemeType\n",
    "\n",
    "bar = (\n",
    "    Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT))\n",
    "    .add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "    .add_yaxis(\"商家A\", [5, 20, 36, 10, 75, 90])\n",
    "    .add_yaxis(\"商家B\", [15, 6, 45, 20, 35, 66])\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"主标题\", subtitle=\"副标题\"))\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts.faker import Faker#这是用来产生伪数据的包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['哈士奇', '萨摩耶', '泰迪', '金毛', '牧羊犬', '吉娃娃', '柯基']"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Faker.choose()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "def bar_base() -> Bar:\n",
    "    c = (\n",
    "        Bar()\n",
    "        .add_xaxis(Faker.choose())\n",
    "        .add_yaxis(\"商家A\", Faker.values())\n",
    "        .add_yaxis(\"商家B\", Faker.values())\n",
    "        .set_global_opts(title_opts=opts.TitleOpts(title=\"Bar-基本示例\", subtitle=\"我是副标题\"))\n",
    "    )\n",
    "    return c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"d7cad75a18a2405db8a56a271e592d06\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_d7cad75a18a2405db8a56a271e592d06 = echarts.init(\n",
       "                    document.getElementById('d7cad75a18a2405db8a56a271e592d06'), 'white', {renderer: 'canvas'});\n",
       "                var option_d7cad75a18a2405db8a56a271e592d06 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"data\": [\n",
       "                107,\n",
       "                88,\n",
       "                40,\n",
       "                62,\n",
       "                148,\n",
       "                120,\n",
       "                130\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"data\": [\n",
       "                83,\n",
       "                52,\n",
       "                26,\n",
       "                22,\n",
       "                105,\n",
       "                79,\n",
       "                130\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u54c8\\u58eb\\u5947\",\n",
       "                \"\\u8428\\u6469\\u8036\",\n",
       "                \"\\u6cf0\\u8fea\",\n",
       "                \"\\u91d1\\u6bdb\",\n",
       "                \"\\u7267\\u7f8a\\u72ac\",\n",
       "                \"\\u5409\\u5a03\\u5a03\",\n",
       "                \"\\u67ef\\u57fa\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Bar-\\u57fa\\u672c\\u793a\\u4f8b\",\n",
       "            \"subtext\": \"\\u6211\\u662f\\u526f\\u6807\\u9898\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_d7cad75a18a2405db8a56a271e592d06.setOption(option_d7cad75a18a2405db8a56a271e592d06);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x201b7bbb4e0>"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar_base().render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 课间题\n",
    "\n",
    "* 如果带了自己电脑请在自己电脑上尝试安装pyecharts\n",
    "\n",
    "* 请从pyecharts主页上复制一段代码下来，在notebook运行并正常显示出图片（注意避免运行带有JsCode函数的代码，这种似乎不行）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## pyecharts的图形修饰逻辑\n",
    "\n",
    "* pyecharts的主页，也是最重要的学习资源： https://pyecharts.org/#/"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 全局配置项\n",
    "\n",
    "\n",
    "* set_global_opts非常重要的修饰函数，负责图形大部分整体的修饰。\n",
    "\n",
    "第一层次\n",
    "\n",
    "* 下面是主页说明，注意这个说明和下面代码用法对比：\n",
    "\n",
    "class TitleOpts(\n",
    "    # 主标题文本，支持使用 \\n 换行。\n",
    "    title: Optional[str] = None,"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#bar.set_global_opts(toolbox_opts=opts.ToolboxOpts(title=\"Bar-渐变圆柱\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"9f561e275bad439cadb842a67680e2d0\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_9f561e275bad439cadb842a67680e2d0 = echarts.init(\n",
       "                    document.getElementById('9f561e275bad439cadb842a67680e2d0'), 'white', {renderer: 'canvas'});\n",
       "                var option_9f561e275bad439cadb842a67680e2d0 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Bar-\\u6e10\\u53d8\\u5706\\u67f1\",\n",
       "            \"link\": \"https://blog.csdn.net/z18222043061/article/details/87882626\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_9f561e275bad439cadb842a67680e2d0.setOption(option_9f561e275bad439cadb842a67680e2d0);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2179115e588>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(title=\"Bar-渐变圆柱\",title_link=\"https://blog.csdn.net/z18222043061/article/details/87882626\"))\n",
    "#注意对比这里修饰的方法与主页对应位置教程的说明，了解pyechart图形修饰模式:\n",
    "#TitleOpts对应class TitleOpts中的类名，title_opts需要把TitleOpts中的title 小写\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "第二层次\n",
    "\n",
    "* 坐标相关的设置\n",
    "\n",
    "class AxisOpts(\n",
    "\n",
    "    # 坐标轴刻度最大值。\n",
    "    # 可以设置成特殊值 'dataMax'，此时取数据在该轴上的最大值作为最大刻度。\n",
    "    # 不设置时会自动计算最大值保证坐标轴刻度的均匀分布。\n",
    "    # 在类目轴中，也可以设置为类目的序数（如类目轴 data: ['类A', '类B', '类C'] 中，序数 2 表示 '类C'。\n",
    "    # 也可以设置为负数，如 -3）。\n",
    " max_: Union[Numeric, str, None] = None,\n",
    " \n",
    " axisline_opts: Union[AxisLineOpts, dict, None] = None,\n",
    " \n",
    " axistick_opts: Union[AxisTickOpts, dict, None] = None,\n",
    " \n",
    " axislabel_opts: Union[LabelOpts, dict, None] = None,\n",
    " \n",
    " * 注意这些配置项的层次关系：set_global_opts-》xaxis_opts-》AxisOpts-》max_或是axislabel_opts等\n",
    " "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"b88c59612c3746fcbbc90989018f5cdc\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_b88c59612c3746fcbbc90989018f5cdc = echarts.init(\n",
       "                    document.getElementById('b88c59612c3746fcbbc90989018f5cdc'), 'white', {renderer: 'canvas'});\n",
       "                var option_b88c59612c3746fcbbc90989018f5cdc = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"axisLine\": {\n",
       "                \"show\": false,\n",
       "                \"onZero\": true,\n",
       "                \"onZeroAxisIndex\": 0\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"max\": 6,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {}\n",
       "    ]\n",
       "};\n",
       "                chart_b88c59612c3746fcbbc90989018f5cdc.setOption(option_b88c59612c3746fcbbc90989018f5cdc);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2179234e550>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.set_global_opts(xaxis_opts=opts.AxisOpts(max_=6,axisline_opts=opts.AxisLineOpts(is_show=False)))#去掉bar的数字标识\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 课间题\n",
    "\n",
    "* 请阅读class TitleOpts的配置项，在上面bar图中加入副标题，内容任意\n",
    "\n",
    "* 请阅读DataZoomOpts：区域缩放配置项部分，在bar图中加入缩放条\n",
    "\n",
    "* 请让y轴的上限为140"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"0787fc0542874ad580286eafddd7db1c\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_0787fc0542874ad580286eafddd7db1c = echarts.init(\n",
       "                    document.getElementById('0787fc0542874ad580286eafddd7db1c'), 'white', {renderer: 'canvas'});\n",
       "                var option_0787fc0542874ad580286eafddd7db1c = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"subtext\": \"ssssss\"\n",
       "        }\n",
       "    ],\n",
       "    \"dataZoom\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"slider\",\n",
       "        \"realtime\": true,\n",
       "        \"start\": 20,\n",
       "        \"end\": 80,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"zoomLock\": false\n",
       "    }\n",
       "};\n",
       "                chart_0787fc0542874ad580286eafddd7db1c.setOption(option_0787fc0542874ad580286eafddd7db1c);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e7e6d8>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opts\n",
    "x=range(1,8)\n",
    "y=[114, 55, 27, 101, 125, 27, 105]\n",
    "\n",
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(subtitle=\"ssssss\"),datazoom_opts=opts.DataZoomOpts(is_show=True))#去掉bar的数字标识\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"107b0ca604ff44658790427a389edbf4\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_107b0ca604ff44658790427a389edbf4 = echarts.init(\n",
       "                    document.getElementById('107b0ca604ff44658790427a389edbf4'), 'white', {renderer: 'canvas'});\n",
       "                var option_107b0ca604ff44658790427a389edbf4 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"iii\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"iii\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"iii\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"max\": 140,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"subtext\": \"Bar-\\u6e10\\u53d8\\u5706\\u67f1\"\n",
       "        }\n",
       "    ],\n",
       "    \"dataZoom\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"slider\",\n",
       "        \"realtime\": true,\n",
       "        \"start\": 20,\n",
       "        \"end\": 80,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"zoomLock\": false\n",
       "    }\n",
       "};\n",
       "                chart_107b0ca604ff44658790427a389edbf4.setOption(option_107b0ca604ff44658790427a389edbf4);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e7e588>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar\n",
    "\n",
    "x=range(1,8)\n",
    "y=[114, 55, 27, 101, 125, 27, 105]\n",
    "\n",
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"iii\", y)\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(subtitle=\"Bar-渐变圆柱\"),\n",
    "                    datazoom_opts=opts.DataZoomOpts(is_show=True),\n",
    "                   yaxis_opts=opts.AxisOpts(max_=140))\n",
    "#bar.set_global_opts()\n",
    "bar.render_notebook()#用来在notebook中展示图形，使用render则会直接保存为html文件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 系列配置项\n",
    "\n",
    "* set_series_opts负责很多系列配置项的定义，比如 LabelOpts；MarkPointOpts；AreaStyleOpts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"72dbdf8a991e48968e9c1593c5b55ccb\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_72dbdf8a991e48968e9c1593c5b55ccb = echarts.init(\n",
       "                    document.getElementById('72dbdf8a991e48968e9c1593c5b55ccb'), 'white', {renderer: 'canvas'});\n",
       "                var option_72dbdf8a991e48968e9c1593c5b55ccb = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_72dbdf8a991e48968e9c1593c5b55ccb.setOption(option_72dbdf8a991e48968e9c1593c5b55ccb);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e7e198>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.set_series_opts(label_opts=opts.LabelOpts(is_show=False))#去掉bar的数字标识\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 标记点的设定\n",
    "\n",
    "class MarkPointOpts(\n",
    "    # 标记点数据，参考 `series_options.MarkPointItem`\n",
    "    data: Sequence[Union[MarkPointItem, dict]] = None,\n",
    "    \n",
    "class MarkPointItem(\n",
    "    # 标注名称。\n",
    "    name: Optional[str] = None,\n",
    "\n",
    "    # 特殊的标注类型，用于标注最大值最小值等。可选:\n",
    "    # 'min' 最大值。\n",
    "    # 'max' 最大值。\n",
    "    # 'average' 平均值。\n",
    "    type_: Optional[str] = None,"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"7c56eec644504d399dd946005f3ea1ec\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_7c56eec644504d399dd946005f3ea1ec = echarts.init(\n",
       "                    document.getElementById('7c56eec644504d399dd946005f3ea1ec'), 'white', {renderer: 'canvas'});\n",
       "                var option_7c56eec644504d399dd946005f3ea1ec = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"inside\",\n",
       "                    \"color\": \"#fff\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5927\\u503c\",\n",
       "                        \"type\": \"max\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5c0f\\u503c\",\n",
       "                        \"type\": \"min\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u5e73\\u5747\\u503c\",\n",
       "                        \"type\": \"average\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_7c56eec644504d399dd946005f3ea1ec.setOption(option_7c56eec644504d399dd946005f3ea1ec);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e6d668>"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.set_series_opts(\n",
    "            label_opts=opts.LabelOpts(is_show=False),\n",
    "            markpoint_opts=opts.MarkPointOpts(\n",
    "                data=[\n",
    "                    opts.MarkPointItem(type_=\"max\", name=\"最大值\"),\n",
    "                    opts.MarkPointItem(type_=\"min\", name=\"最小值\"),\n",
    "                    opts.MarkPointItem(type_=\"average\", name=\"平均值\"),\n",
    "                ]\n",
    "            ))#去掉bar的数字标识\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 有一些系列配置是放在其他地方的，这取决于此配置项用来修饰的对象。比如itemstyle_opts用来修饰bar的颜色时就放在add_yaxis里。要确定配置的使用位置，比如add_yaxsi这种函数包含哪些配置项建议先阅读每个图形最前面的，class说明"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"16ff706a5276498da5a90565301aeb3c\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_16ff706a5276498da5a90565301aeb3c = echarts.init(\n",
       "                    document.getElementById('16ff706a5276498da5a90565301aeb3c'), 'white', {renderer: 'canvas'});\n",
       "                var option_16ff706a5276498da5a90565301aeb3c = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"itemStyle\": {\n",
       "                \"color\": \"pink\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_16ff706a5276498da5a90565301aeb3c.setOption(option_16ff706a5276498da5a90565301aeb3c);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e6df28>"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar()\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y,itemstyle_opts=opts.ItemStyleOpts(color=\"pink\"),)\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 有些配置需要在图形函数中配置，比如主题的设定\n",
    "\n",
    "https://pyecharts.org/#/zh-cn/themes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts.globals import ThemeType"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'chalk':'https://assets.pyecharts.org/assets/themes/chalk'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"75942408df0e4a0181384063028b340e\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'chalk'], function(echarts) {\n",
       "                var chart_75942408df0e4a0181384063028b340e = echarts.init(\n",
       "                    document.getElementById('75942408df0e4a0181384063028b340e'), 'chalk', {renderer: 'canvas'});\n",
       "                var option_75942408df0e4a0181384063028b340e = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_75942408df0e4a0181384063028b340e.setOption(option_75942408df0e4a0181384063028b340e);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e7ec18>"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#LIGHT DARK CHALK ESSOS PURPLE_PASSION\n",
    "bar = Bar(init_opts=opts.InitOpts(theme=ThemeType.CHALK))\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 课间题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'essos':'https://assets.pyecharts.org/assets/themes/essos'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"18e437fdac5b4d50a0faf4faf3074237\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'essos'], function(echarts) {\n",
       "                var chart_18e437fdac5b4d50a0faf4faf3074237 = echarts.init(\n",
       "                    document.getElementById('18e437fdac5b4d50a0faf4faf3074237'), 'essos', {renderer: 'canvas'});\n",
       "                var option_18e437fdac5b4d50a0faf4faf3074237 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 20,\n",
       "                \"fontStyle\": \"italic\"\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"silent\": false,\n",
       "                \"precision\": 2,\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"\\u5927\\u5927\\u5927\",\n",
       "                        \"type\": \"max\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u5c0f\\u5c0f\\u5c0f\",\n",
       "                        \"type\": \"min\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"max\": 135,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {}\n",
       "    ]\n",
       "};\n",
       "                chart_18e437fdac5b4d50a0faf4faf3074237.setOption(option_18e437fdac5b4d50a0faf4faf3074237);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e7e518>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar(init_opts=opts.InitOpts(theme=ThemeType.ESSOS))\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.set_series_opts(label_opts=opts.LabelOpts(font_style=\"italic\",font_size=20),\n",
    "                   markline_opts=opts.MarkLineOpts(data=[opts.MarkLineItem(type_=\"max\",name=\"大大大\"),\n",
    "                                                         opts.MarkLineItem(type_=\"min\",name=\"小小小\")]))#去掉bar的数字标识\n",
    "bar.set_global_opts(yaxis_opts=opts.AxisOpts(max_=135))\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'essos':'https://assets.pyecharts.org/assets/themes/essos'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"fe44fc6935de4a8c82b127289774e1c6\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'essos'], function(echarts) {\n",
       "                var chart_fe44fc6935de4a8c82b127289774e1c6 = echarts.init(\n",
       "                    document.getElementById('fe44fc6935de4a8c82b127289774e1c6'), 'essos', {renderer: 'canvas'});\n",
       "                var option_fe44fc6935de4a8c82b127289774e1c6 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 20,\n",
       "                \"fontStyle\": \"italic\"\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"silent\": false,\n",
       "                \"precision\": 2,\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5927\\u503c\",\n",
       "                        \"type\": \"max\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5c0f\\u503c\",\n",
       "                        \"type\": \"min\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u5e73\\u5747\\u503c\",\n",
       "                        \"type\": \"average\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"max\": 135,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {}\n",
       "    ]\n",
       "};\n",
       "                chart_fe44fc6935de4a8c82b127289774e1c6.setOption(option_fe44fc6935de4a8c82b127289774e1c6);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x21793e6db38>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar\n",
    "\n",
    "x=range(1,8)\n",
    "y=[114, 55, 27, 101, 125, 27, 105]\n",
    "\n",
    "bar = Bar(init_opts=opts.InitOpts(theme=ThemeType.ESSOS))\n",
    "bar.add_xaxis(list(x))\n",
    "bar.add_yaxis(\"name\", y)\n",
    "bar.set_series_opts(label_opts=opts.LabelOpts(font_size=20,font_style=\"italic\"),\n",
    "            markline_opts=opts.MarkLineOpts(\n",
    "                data=[\n",
    "                    opts.MarkLineItem(type_=\"max\", name=\"最大值\"),\n",
    "                    opts.MarkLineItem(type_=\"min\", name=\"最小值\"),\n",
    "                    opts.MarkLineItem(type_=\"average\", name=\"平均值\"),\n",
    "                ]\n",
    "            ))#去掉bar的数字标识\n",
    "bar.set_global_opts(yaxis_opts=opts.AxisOpts(max_=135))\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'essos':'https://assets.pyecharts.org/assets/themes/essos'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"1bc843e8f3dd4146ab7d526bc28eff36\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'essos'], function(echarts) {\n",
       "                var chart_1bc843e8f3dd4146ab7d526bc28eff36 = echarts.init(\n",
       "                    document.getElementById('1bc843e8f3dd4146ab7d526bc28eff36'), 'essos', {renderer: 'canvas'});\n",
       "                var option_1bc843e8f3dd4146ab7d526bc28eff36 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"name\",\n",
       "            \"data\": [\n",
       "                114,\n",
       "                55,\n",
       "                27,\n",
       "                101,\n",
       "                125,\n",
       "                27,\n",
       "                105\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 20,\n",
       "                \"fontStyle\": \"italic\"\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"silent\": false,\n",
       "                \"precision\": 2,\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8\n",
       "                },\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5927\\u503c\",\n",
       "                        \"type\": \"max\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u6700\\u5c0f\\u503c\",\n",
       "                        \"type\": \"min\"\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"\\u5e73\\u5747\\u503c\",\n",
       "                        \"type\": \"average\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"name\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"name\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1,\n",
       "                2,\n",
       "                3,\n",
       "                4,\n",
       "                5,\n",
       "                6,\n",
       "                7\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"max\": 135,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {}\n",
       "    ]\n",
       "};\n",
       "                chart_1bc843e8f3dd4146ab7d526bc28eff36.setOption(option_1bc843e8f3dd4146ab7d526bc28eff36);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1af16c94320>"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#请尝试再上面bar作图中，引入ESSOS主题，并设置柱标为斜体，并这只字体大小为20\n",
    "# 在bar作图中，请给图中的最大值，最小值，平均值位置做线标\n",
    "#在全局设定中定义y轴的最大值为135"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## pyecharts的数据类型问题\n",
    "\n",
    "https://pyecharts.org/#/zh-cn/data_format\n",
    "\n",
    "由于pyecharts背后封装的js库，会涉及到数据类型转化。它暂时要求输入数据必须是python的基础数据类型，比如字符串，列表，字典，而不能是序列这样的数据类型。因此序列输入量需要事先被转化为list等基础数据类型才能被pyecharts支持"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "op1=open(r'D:\\try\\shoes.json', 'r',encoding='utf-8')\n",
    "li=[]\n",
    "dict1={}\n",
    "for i in op1:\n",
    "    k=json.loads(i.encode(\"utf-8\"))#把字符串转换为json\n",
    "    li.append(k)\n",
    "a=json_normalize(li)#把由json数据构成的列表转换成数据框"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['_id.$oid', 'info.上市年份季节', 'info.上市时间', 'info.产品名称', 'info.低帮鞋品名',\n",
       "       'info.功能', 'info.吊牌价', 'info.品牌', 'info.图案', 'info.场合', 'info.外底材料',\n",
       "       'info.季节', 'info.尺码', 'info.帮面内里材质', 'info.帮面材质', 'info.性别',\n",
       "       'info.是否商场同款', 'info.是否瑕疵', 'info.款号', 'info.款式', 'info.流行元素',\n",
       "       'info.真皮材质工艺', 'info.细分风格', 'info.货号', 'info.跟底款式', 'info.运动系列',\n",
       "       'info.运动鞋科技', 'info.适合路面', 'info.适用对象', 'info.销售渠道类型', 'info.闭合方式',\n",
       "       'info.靴子品名', 'info.靴筒内里材质', 'info.靴筒材质', 'info.靴筒高度', 'info.鞋制作工艺',\n",
       "       'info.鞋垫材质', 'info.鞋头款式', 'info.鞋底材质', 'info.鞋码', 'info.鞋跟高',\n",
       "       'info.鞋面内里材质', 'info.鞋面材质', 'info.颜色分类', 'info.风格', 'itemid',\n",
       "       'location', 'nick', 'price', 'sales', 'title', 'url'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>_id.$oid</th>\n",
       "      <th>info.上市年份季节</th>\n",
       "      <th>info.上市时间</th>\n",
       "      <th>info.产品名称</th>\n",
       "      <th>info.低帮鞋品名</th>\n",
       "      <th>info.功能</th>\n",
       "      <th>info.吊牌价</th>\n",
       "      <th>info.品牌</th>\n",
       "      <th>info.图案</th>\n",
       "      <th>info.场合</th>\n",
       "      <th>...</th>\n",
       "      <th>info.鞋面材质</th>\n",
       "      <th>info.颜色分类</th>\n",
       "      <th>info.风格</th>\n",
       "      <th>itemid</th>\n",
       "      <th>location</th>\n",
       "      <th>nick</th>\n",
       "      <th>price</th>\n",
       "      <th>sales</th>\n",
       "      <th>title</th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5aa77041be9b0338dc1faab4</td>\n",
       "      <td>2018年春季</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>商务休闲鞋</td>\n",
       "      <td>轻质</td>\n",
       "      <td>NaN</td>\n",
       "      <td>YEARCON/意尔康</td>\n",
       "      <td>纯色</td>\n",
       "      <td>日常</td>\n",
       "      <td>...</td>\n",
       "      <td>头层牛皮（除牛反绒）</td>\n",
       "      <td>黑色土黄</td>\n",
       "      <td>商务</td>\n",
       "      <td>562121114807</td>\n",
       "      <td>浙江 丽水</td>\n",
       "      <td>意尔康皮鞋旗舰店</td>\n",
       "      <td>269.00</td>\n",
       "      <td>1583人付款</td>\n",
       "      <td>意尔康男鞋2018春季新款英伦真皮商务休闲皮鞋青年男士皮鞋子男潮</td>\n",
       "      <td>http://detail.tmall.com/item.htm?id=5621211148...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 52 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   _id.$oid info.上市年份季节 info.上市时间 info.产品名称 info.低帮鞋品名  \\\n",
       "0  5aa77041be9b0338dc1faab4     2018年春季       NaN       NaN      商务休闲鞋   \n",
       "\n",
       "  info.功能 info.吊牌价      info.品牌 info.图案 info.场合  \\\n",
       "0      轻质      NaN  YEARCON/意尔康      纯色      日常   \n",
       "\n",
       "                         ...                           info.鞋面材质 info.颜色分类  \\\n",
       "0                        ...                          头层牛皮（除牛反绒）      黑色土黄   \n",
       "\n",
       "  info.风格        itemid location      nick   price    sales  \\\n",
       "0      商务  562121114807    浙江 丽水  意尔康皮鞋旗舰店  269.00  1583人付款   \n",
       "\n",
       "                              title  \\\n",
       "0  意尔康男鞋2018春季新款英伦真皮商务休闲皮鞋青年男士皮鞋子男潮   \n",
       "\n",
       "                                                 url  \n",
       "0  http://detail.tmall.com/item.htm?id=5621211148...  \n",
       "\n",
       "[1 rows x 52 columns]"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.head(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "info.鞋面材质\n",
       "头层牛皮（除牛反绒）    3470\n",
       "PU             671\n",
       "二层牛皮（除牛反绒）     605\n",
       "人造革             80\n",
       "超纤              35\n",
       "多种材质拼接          21\n",
       "绒面              15\n",
       "磨砂皮             14\n",
       "牛反绒             12\n",
       "塑胶              10\n",
       "太空革              9\n",
       "二层猪皮             8\n",
       "布                8\n",
       "网布               7\n",
       "头层猪皮             6\n",
       "鳄鱼皮              4\n",
       "牛仔布              2\n",
       "超纤皮              1\n",
       "棉布               1\n",
       "羊皮毛一体            1\n",
       "dtype: int64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p0=a.groupby(\"info.鞋面材质\").size().sort_values(ascending=False)\n",
    "p0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[3470, 671, 605, 80, 35, 21, 15, 14, 12, 10, 9, 8, 8, 7, 6, 4, 2, 1, 1, 1]"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p0.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"e779f0d545c54dbc8bccc01aad61df38\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_e779f0d545c54dbc8bccc01aad61df38 = echarts.init(\n",
       "                    document.getElementById('e779f0d545c54dbc8bccc01aad61df38'), 'white', {renderer: 'canvas'});\n",
       "                var option_e779f0d545c54dbc8bccc01aad61df38 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"data\": [\n",
       "                3470,\n",
       "                671,\n",
       "                605,\n",
       "                80,\n",
       "                35,\n",
       "                21,\n",
       "                15,\n",
       "                14,\n",
       "                12,\n",
       "                10,\n",
       "                9,\n",
       "                8,\n",
       "                8,\n",
       "                7,\n",
       "                6,\n",
       "                4,\n",
       "                2,\n",
       "                1,\n",
       "                1,\n",
       "                1\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"PU\",\n",
       "                \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"\\u4eba\\u9020\\u9769\",\n",
       "                \"\\u8d85\\u7ea4\",\n",
       "                \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                \"\\u7ed2\\u9762\",\n",
       "                \"\\u78e8\\u7802\\u76ae\",\n",
       "                \"\\u725b\\u53cd\\u7ed2\",\n",
       "                \"\\u5851\\u80f6\",\n",
       "                \"\\u592a\\u7a7a\\u9769\",\n",
       "                \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u5e03\",\n",
       "                \"\\u7f51\\u5e03\",\n",
       "                \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                \"\\u725b\\u4ed4\\u5e03\",\n",
       "                \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                \"\\u68c9\\u5e03\",\n",
       "                \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u67d0\\u5546\\u573a\\u9500\\u552e\\u60c5\\u51b5\"\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "                chart_e779f0d545c54dbc8bccc01aad61df38.setOption(option_e779f0d545c54dbc8bccc01aad61df38);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2179699eeb8>"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar()\n",
    "bar.add_xaxis(p0.index.tolist())\n",
    "bar.add_yaxis(\"商家A\", p0.tolist())\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(title=\"某商场销售情况\"),toolbox_opts=opts.ToolboxOpts())\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts.charts import Page, Pie"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['头层牛皮（除牛反绒）', 3470],\n",
       " ['PU', 671],\n",
       " ['二层牛皮（除牛反绒）', 605],\n",
       " ['人造革', 80],\n",
       " ['超纤', 35],\n",
       " ['多种材质拼接', 21],\n",
       " ['绒面', 15],\n",
       " ['磨砂皮', 14],\n",
       " ['牛反绒', 12],\n",
       " ['塑胶', 10],\n",
       " ['太空革', 9],\n",
       " ['二层猪皮', 8],\n",
       " ['布', 8],\n",
       " ['网布', 7],\n",
       " ['头层猪皮', 6],\n",
       " ['鳄鱼皮', 4],\n",
       " ['牛仔布', 2],\n",
       " ['超纤皮', 1],\n",
       " ['棉布', 1],\n",
       " ['羊皮毛一体', 1]]"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[list(z) for z in zip(p0.index.tolist(), p0.tolist())]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "info.鞋面材质\n",
       "头层牛皮（除牛反绒）    3470\n",
       "PU             671\n",
       "二层牛皮（除牛反绒）     605\n",
       "人造革             80\n",
       "超纤              35\n",
       "多种材质拼接          21\n",
       "绒面              15\n",
       "磨砂皮             14\n",
       "牛反绒             12\n",
       "塑胶              10\n",
       "太空革              9\n",
       "二层猪皮             8\n",
       "布                8\n",
       "网布               7\n",
       "头层猪皮             6\n",
       "鳄鱼皮              4\n",
       "牛仔布              2\n",
       "超纤皮              1\n",
       "棉布               1\n",
       "羊皮毛一体            1\n",
       "dtype: int64"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2, 4]\n",
      "[4, 7]\n"
     ]
    }
   ],
   "source": [
    "for i in zip([2,4],[4,7]):\n",
    "    print(list(i))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"e5dd814763d94352aa1595346b665a46\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_e5dd814763d94352aa1595346b665a46 = echarts.init(\n",
       "                    document.getElementById('e5dd814763d94352aa1595346b665a46'), 'white', {renderer: 'canvas'});\n",
       "                var option_e5dd814763d94352aa1595346b665a46 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"clockwise\": true,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                    \"value\": 3470\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"PU\",\n",
       "                    \"value\": 671\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                    \"value\": 605\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4eba\\u9020\\u9769\",\n",
       "                    \"value\": 80\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d85\\u7ea4\",\n",
       "                    \"value\": 35\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                    \"value\": 21\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7ed2\\u9762\",\n",
       "                    \"value\": 15\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u78e8\\u7802\\u76ae\",\n",
       "                    \"value\": 14\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u725b\\u53cd\\u7ed2\",\n",
       "                    \"value\": 12\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5851\\u80f6\",\n",
       "                    \"value\": 10\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u592a\\u7a7a\\u9769\",\n",
       "                    \"value\": 9\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                    \"value\": 8\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e03\",\n",
       "                    \"value\": 8\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7f51\\u5e03\",\n",
       "                    \"value\": 7\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                    \"value\": 6\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                    \"value\": 4\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u725b\\u4ed4\\u5e03\",\n",
       "                    \"value\": 2\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                    \"value\": 1\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u68c9\\u5e03\",\n",
       "                    \"value\": 1\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\",\n",
       "                    \"value\": 1\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                \"0%\",\n",
       "                \"75%\"\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"PU\",\n",
       "                \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"\\u4eba\\u9020\\u9769\",\n",
       "                \"\\u8d85\\u7ea4\",\n",
       "                \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                \"\\u7ed2\\u9762\",\n",
       "                \"\\u78e8\\u7802\\u76ae\",\n",
       "                \"\\u725b\\u53cd\\u7ed2\",\n",
       "                \"\\u5851\\u80f6\",\n",
       "                \"\\u592a\\u7a7a\\u9769\",\n",
       "                \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u5e03\",\n",
       "                \"\\u7f51\\u5e03\",\n",
       "                \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                \"\\u725b\\u4ed4\\u5e03\",\n",
       "                \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                \"\\u68c9\\u5e03\",\n",
       "                \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"left\": \"2%\",\n",
       "            \"top\": \"15%\",\n",
       "            \"orient\": \"vertical\"\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Pie-Radius\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_e5dd814763d94352aa1595346b665a46.setOption(option_e5dd814763d94352aa1595346b665a46);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2b01877d908>"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f2=Pie().add(\"\", [list(z) for z in zip(p0.index.tolist(), p0.tolist())])\n",
    "f2.set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "f2.set_global_opts(\n",
    "            title_opts=opts.TitleOpts(title=\"Pie-Radius\"),\n",
    "            legend_opts=opts.LegendOpts(\n",
    "                orient=\"vertical\", pos_top=\"15%\", pos_left=\"2%\"\n",
    "            ),\n",
    "        )\n",
    "f2.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 课间题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 翻转bar图的x,y轴\n",
    "p0=p0.sort_values()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"c0ff442ad5f54b6699c99287492f9958\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_c0ff442ad5f54b6699c99287492f9958 = echarts.init(\n",
       "                    document.getElementById('c0ff442ad5f54b6699c99287492f9958'), 'white', {renderer: 'canvas'});\n",
       "                var option_c0ff442ad5f54b6699c99287492f9958 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"data\": [\n",
       "                1,\n",
       "                1,\n",
       "                1,\n",
       "                2,\n",
       "                4,\n",
       "                6,\n",
       "                7,\n",
       "                8,\n",
       "                8,\n",
       "                9,\n",
       "                10,\n",
       "                12,\n",
       "                14,\n",
       "                15,\n",
       "                21,\n",
       "                35,\n",
       "                80,\n",
       "                605,\n",
       "                671,\n",
       "                3470\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\",\n",
       "                \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                \"\\u68c9\\u5e03\",\n",
       "                \"\\u725b\\u4ed4\\u5e03\",\n",
       "                \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u7f51\\u5e03\",\n",
       "                \"\\u5e03\",\n",
       "                \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u592a\\u7a7a\\u9769\",\n",
       "                \"\\u5851\\u80f6\",\n",
       "                \"\\u725b\\u53cd\\u7ed2\",\n",
       "                \"\\u78e8\\u7802\\u76ae\",\n",
       "                \"\\u7ed2\\u9762\",\n",
       "                \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                \"\\u8d85\\u7ea4\",\n",
       "                \"\\u4eba\\u9020\\u9769\",\n",
       "                \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"PU\",\n",
       "                \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u67d0\\u5546\\u573a\\u9500\\u552e\\u60c5\\u51b5\"\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "                chart_c0ff442ad5f54b6699c99287492f9958.setOption(option_c0ff442ad5f54b6699c99287492f9958);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1b399c47710>"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 做皮鞋材质数量分布的线图（Line）\n",
    "from pyecharts.charts import Line"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"9475c015b00346828ad1c66177f94f9a\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_9475c015b00346828ad1c66177f94f9a = echarts.init(\n",
       "                    document.getElementById('9475c015b00346828ad1c66177f94f9a'), 'white', {renderer: 'canvas'});\n",
       "                var option_9475c015b00346828ad1c66177f94f9a = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u76ae\\u978b\\u6750\\u8d28\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\",\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u68c9\\u5e03\",\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u725b\\u4ed4\\u5e03\",\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u7f51\\u5e03\",\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5e03\",\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u592a\\u7a7a\\u9769\",\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5851\\u80f6\",\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u725b\\u53cd\\u7ed2\",\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u78e8\\u7802\\u76ae\",\n",
       "                    14\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u7ed2\\u9762\",\n",
       "                    15\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                    21\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8d85\\u7ea4\",\n",
       "                    35\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4eba\\u9020\\u9769\",\n",
       "                    80\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                    605\n",
       "                ],\n",
       "                [\n",
       "                    \"PU\",\n",
       "                    671\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                    3470\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u76ae\\u978b\\u6750\\u8d28\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u76ae\\u978b\\u6750\\u8d28\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\",\n",
       "                \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                \"\\u68c9\\u5e03\",\n",
       "                \"\\u725b\\u4ed4\\u5e03\",\n",
       "                \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u7f51\\u5e03\",\n",
       "                \"\\u5e03\",\n",
       "                \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u592a\\u7a7a\\u9769\",\n",
       "                \"\\u5851\\u80f6\",\n",
       "                \"\\u725b\\u53cd\\u7ed2\",\n",
       "                \"\\u78e8\\u7802\\u76ae\",\n",
       "                \"\\u7ed2\\u9762\",\n",
       "                \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                \"\\u8d85\\u7ea4\",\n",
       "                \"\\u4eba\\u9020\\u9769\",\n",
       "                \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"PU\",\n",
       "                \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u610f\\u5c14\\u5eb7\\u7537\\u978b\\u5206\\u6790\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_9475c015b00346828ad1c66177f94f9a.setOption(option_9475c015b00346828ad1c66177f94f9a);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1b39c8f9cf8>"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 做皮鞋材质数量分布的漏斗图（Funnel）\n",
    "from pyecharts.charts import Funnel, Page"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"10028cd55ef1474cb7753c53112f8265\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_10028cd55ef1474cb7753c53112f8265 = echarts.init(\n",
       "                    document.getElementById('10028cd55ef1474cb7753c53112f8265'), 'white', {renderer: 'canvas'});\n",
       "                var option_10028cd55ef1474cb7753c53112f8265 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"funnel\",\n",
       "            \"name\": \"\\u76ae\\u978b\\u6750\\u8d28\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\",\n",
       "                    \"value\": 1\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                    \"value\": 1\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u68c9\\u5e03\",\n",
       "                    \"value\": 1\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u725b\\u4ed4\\u5e03\",\n",
       "                    \"value\": 2\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                    \"value\": 4\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                    \"value\": 6\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7f51\\u5e03\",\n",
       "                    \"value\": 7\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e03\",\n",
       "                    \"value\": 8\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                    \"value\": 8\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u592a\\u7a7a\\u9769\",\n",
       "                    \"value\": 9\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5851\\u80f6\",\n",
       "                    \"value\": 10\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u725b\\u53cd\\u7ed2\",\n",
       "                    \"value\": 12\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u78e8\\u7802\\u76ae\",\n",
       "                    \"value\": 14\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7ed2\\u9762\",\n",
       "                    \"value\": 15\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                    \"value\": 21\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d85\\u7ea4\",\n",
       "                    \"value\": 35\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4eba\\u9020\\u9769\",\n",
       "                    \"value\": 80\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                    \"value\": 605\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"PU\",\n",
       "                    \"value\": 671\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                    \"value\": 3470\n",
       "                }\n",
       "            ],\n",
       "            \"sort\": \"ascending\",\n",
       "            \"gap\": 0,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u592a\\u7a7a\\u9769\",\n",
       "                \"\\u78e8\\u7802\\u76ae\",\n",
       "                \"\\u725b\\u53cd\\u7ed2\",\n",
       "                \"\\u7ed2\\u9762\",\n",
       "                \"\\u7f51\\u5e03\",\n",
       "                \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                \"\\u4eba\\u9020\\u9769\",\n",
       "                \"\\u5851\\u80f6\",\n",
       "                \"\\u725b\\u4ed4\\u5e03\",\n",
       "                \"\\u8d85\\u7ea4\",\n",
       "                \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\",\n",
       "                \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                \"\\u68c9\\u5e03\",\n",
       "                \"\\u5e03\",\n",
       "                \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                \"PU\",\n",
       "                \"\\u9cc4\\u9c7c\\u76ae\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\": true,\n",
       "                \"\\u8d85\\u7ea4\\u76ae\": true,\n",
       "                \"\\u68c9\\u5e03\": true,\n",
       "                \"\\u725b\\u4ed4\\u5e03\": true,\n",
       "                \"\\u9cc4\\u9c7c\\u76ae\": true,\n",
       "                \"\\u5934\\u5c42\\u732a\\u76ae\": true,\n",
       "                \"\\u7f51\\u5e03\": true,\n",
       "                \"\\u5e03\": true,\n",
       "                \"\\u4e8c\\u5c42\\u732a\\u76ae\": true,\n",
       "                \"\\u592a\\u7a7a\\u9769\": true,\n",
       "                \"\\u5851\\u80f6\": true,\n",
       "                \"\\u725b\\u53cd\\u7ed2\": true,\n",
       "                \"\\u78e8\\u7802\\u76ae\": true,\n",
       "                \"\\u7ed2\\u9762\": true,\n",
       "                \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\": true,\n",
       "                \"\\u8d85\\u7ea4\": true,\n",
       "                \"\\u4eba\\u9020\\u9769\": true,\n",
       "                \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\": true,\n",
       "                \"PU\": true,\n",
       "                \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    }\n",
       "};\n",
       "                chart_10028cd55ef1474cb7753c53112f8265.setOption(option_10028cd55ef1474cb7753c53112f8265);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1b39c8f9fd0>"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 做皮鞋材质分布的象形柱状图（PictorialBar）\n",
    "from pyecharts.charts import Page, PictorialBar\n",
    "from pyecharts.globals import SymbolType"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"86c8047555c84af8b636446d501db145\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_86c8047555c84af8b636446d501db145 = echarts.init(\n",
       "                    document.getElementById('86c8047555c84af8b636446d501db145'), 'white', {renderer: 'canvas'});\n",
       "                var option_86c8047555c84af8b636446d501db145 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pictorialBar\",\n",
       "            \"symbol\": \"roundRect\",\n",
       "            \"symbolSize\": 18,\n",
       "            \"symbolOffset\": [\n",
       "                0,\n",
       "                0\n",
       "            ],\n",
       "            \"symbolRepeat\": \"fixed\",\n",
       "            \"symbolClip\": true,\n",
       "            \"name\": \"\\u6750\\u8d28\",\n",
       "            \"data\": [\n",
       "                1,\n",
       "                1,\n",
       "                1,\n",
       "                2,\n",
       "                4,\n",
       "                6,\n",
       "                7,\n",
       "                8,\n",
       "                8,\n",
       "                9,\n",
       "                10,\n",
       "                12,\n",
       "                14,\n",
       "                15,\n",
       "                21,\n",
       "                35,\n",
       "                80,\n",
       "                605,\n",
       "                671,\n",
       "                3470\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u6750\\u8d28\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u6750\\u8d28\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u7f8a\\u76ae\\u6bdb\\u4e00\\u4f53\",\n",
       "                \"\\u8d85\\u7ea4\\u76ae\",\n",
       "                \"\\u68c9\\u5e03\",\n",
       "                \"\\u725b\\u4ed4\\u5e03\",\n",
       "                \"\\u9cc4\\u9c7c\\u76ae\",\n",
       "                \"\\u5934\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u7f51\\u5e03\",\n",
       "                \"\\u5e03\",\n",
       "                \"\\u4e8c\\u5c42\\u732a\\u76ae\",\n",
       "                \"\\u592a\\u7a7a\\u9769\",\n",
       "                \"\\u5851\\u80f6\",\n",
       "                \"\\u725b\\u53cd\\u7ed2\",\n",
       "                \"\\u78e8\\u7802\\u76ae\",\n",
       "                \"\\u7ed2\\u9762\",\n",
       "                \"\\u591a\\u79cd\\u6750\\u8d28\\u62fc\\u63a5\",\n",
       "                \"\\u8d85\\u7ea4\",\n",
       "                \"\\u4eba\\u9020\\u9769\",\n",
       "                \"\\u4e8c\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\",\n",
       "                \"PU\",\n",
       "                \"\\u5934\\u5c42\\u725b\\u76ae\\uff08\\u9664\\u725b\\u53cd\\u7ed2\\uff09\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u67d0\\u5546\\u573a\\u9500\\u552e\\u60c5\\u51b5\"\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "                chart_86c8047555c84af8b636446d501db145.setOption(option_86c8047555c84af8b636446d501db145);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x13776ed87b8>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 求“info.鞋面内里材质”的各个材质的商品数量，请分别做bar,Line,Funnel,pie，PictorialBar 图来可视化此数据(注意数据类型转换)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
